﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CharacterCreation.Data.Services {
    public class ImportService {
        /// <summary>
        /// The documents
        /// </summary>
        public IEnumerable<string> Documents {
            get {
                var feed = new GoogleService().DocumentsFeed;
                return feed.Entries.Select(e => e.Title.Text);
            }
        }


        public void ImportAll() {
            foreach (var document in this.Documents)
                ImportAll(document);
        }

        private void ImportAll(string document) {
            if (document.StartsWith("Skill")) {
                SkillService skillService = SkillService.CreateInstance();
                skillService.Import();
            }
            if (document.StartsWith("Character")) {
                CharacterService characterService = CharacterService.CreateInstance();
                characterService.Import();
            }
            if (document.StartsWith("Race")) {
                RaceService raceService = RaceService.CreateInstance();
                raceService.Import();
            }
            if (document.StartsWith("Special")) {
                SpecialService specialService = SpecialService.CreateInstance();
                specialService.Import();
            }
            if (document.StartsWith("Strength")) {
                StrengthService strengthService = StrengthService.CreateInstance();
                strengthService.Import();
            }
            if (document.StartsWith("Dexterity")) {
                DexterityService dexterityService = DexterityService.CreateInstance();
                dexterityService.Import();
            }
            if (document.StartsWith("Fighting")) {
                FightingService fightingService = FightingService.CreateInstance();
                fightingService.Import();
            }
            if (document.StartsWith("Constitution")) {
                ConstitutionService constitutionService = ConstitutionService.CreateInstance();
                constitutionService.Import();
            }
            if (document.StartsWith("Perception")) {
                PerceptionService perceptionService = PerceptionService.CreateInstance();
                perceptionService.Import();
            }
            if (document.StartsWith("Intelligence")) {
                IntelligenceService intelligenceService = IntelligenceService.CreateInstance();
                intelligenceService.Import();
            }
            if (document.StartsWith("WillPower")) {
                WillPowerService willPowerService = WillPowerService.CreateInstance();
                willPowerService.Import();
            }
            if (document.StartsWith("Charisma")) {
                CharismaService charismaService = CharismaService.CreateInstance();
                charismaService.Import();
            }
        }


    }
}
